//
// Created by chizuru on 2025/9/8.
//

#pragma once

#include "DeviceComm.h"
#include "IProtocolCodec.h"

class CameraDevice {
public:
    CameraDevice(DeviceComm& comm, std::unique_ptr<IProtocolCodec> codec);

    std::optional<uint32_t> readRegister(uint16_t addr);

    bool writeRegister(uint16_t addr, uint32_t value);

    void setRetryPolicy(const RetryPolicy& rp);
private:
    DeviceComm& comm;
    RetryPolicy retryPolicy;
    std::unique_ptr<IProtocolCodec> codec;
    const std::chrono::milliseconds CCD_COMMAND_TRANSMIT_TIME_BOB{80};
    const std::chrono::milliseconds CCD_COMMAND_TIMEOUT_BOB{1000};
    const std::chrono::milliseconds CCD_COMMAND_INTER_READ_DELAY_BOB{10};
};
